package com.cdd.common.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

@Data
@TableName("sys_area")
public class SsArea implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField("parent_id")
    private Integer parentId;

    @TableField("code")
    private String code;

    @TableField("name")
    private String name;

    public static SsArea buildArea(SsCities param) {
        SsArea area = new SsArea();
        area.setId(param.getCityid());
        area.setParentId(param.getProvinceid());
        area.setCode(param.getCityid().toString());
        area.setName(param.getCity());
        return area;
    }
}
